package com.atguigu.spzx.service.util;

import com.atguigu.spzx.model.entity.system.SysUser;

/**
 * @author MikeCoder
 * @create 2023-12-0416:04
 * @description:
 * @verson:
 */
public class AuthContextUtil {
    //1.创建一个ThreadLocal对象
    private static final ThreadLocal<SysUser> threadLocal = new ThreadLocal<>();

    //2.定义存储数据的静态方法
    public static void set(SysUser sysUser){
        threadLocal.set(sysUser);
    }
    //3.定义获取数据的方法
    public static SysUser get(){
        return threadLocal.get();
    }
    //4.删除数据的方法
    public static void remove(){
        threadLocal.remove();
    }
}
